package com.dex4d.ui.wallet.activity;

import android.view.View;
import android.widget.TextView;

import com.dex4d.R;
import com.dex4d.model.User;
import com.dex4d.utils.Commons;

import butterknife.BindView;

/**
 * Created by chengyuchun on 2018/10/29.
 */
public class ConfirmPinActivity extends PinActivity implements Commons.BUNDLE_KEYS {

    @BindView(R.id.tv_pin_title)
    TextView mTvPinTitle;

    @BindView(R.id.tv_pin_error)
    TextView tv_pin_error;

    @Override
    protected void initToolbar() {
        super.initToolbar();
        mTvPinTitle.setText(getString(R.string.confirm_your_pin));
    }

    @Override
    protected void operatePins() {
        String confirmPins = getPins();
        String pins = getIntent().getStringExtra(Commons.BUNDLE_KEYS.PIN_CODE);
        if(pins.equals(confirmPins)){
            User.getInstance().setPinCode(pins);
            User.getInstance().save();

            openActivity(InvitationActivity.class,getIntent().getExtras());
            finish();
        }else {
            tv_pin_error.setVisibility(View.VISIBLE);
        }
    }
}
